Add role-based HR data agent with scope-based field redaction via AgentCore Gateway#1262
Open
zubeens wants to merge 4 commits intoawslabs:mainfrom
Open
Add role-based HR data agent with scope-based field redaction via AgentCore Gateway#1262zubeens wants to merge 4 commits intoawslabs:mainfrom
zubeens wants to merge 4 commits intoawslabs:mainfrom
Conversation
Demonstrates scope-based HR data access using AgentCore Gateway interceptors and Cedar policy engine. An HR Manager sees full employee records; an HR Specialist sees profiles but not compensation; an Employee sees names only. DLP redaction is applied transparently by the Response Interceptor — no application code changes needed when switching personas.
- dummy_data.py: MD5 usedforsecurity=False (bandit B324) - cognito.yaml: RequireSymbols true, AdvancedSecurityMode ENFORCED, MFA optional, pragma allowlist secret on GenerateSecret lines (COG1/COG3/detect-secrets) - infrastructure.yaml: Lambda runtime python3.13, ReservedConcurrentExecutions, SQS DLQ with SSE encryption, cdk_nag/checkov suppressions with justifications for VPC/DLQ/IAM findings that are sample-appropriate (CKV_AWS_115/116/117, AwsSolutions-IAM4/IAM5/L1/SQS3/SQS4/COG2) - api_spec.json: add securitySchemes + global security field (CKV_OPENAPI_4/5) - main.py: nosemgrep for BedrockAgentCoreApp.run() false positive - app.py: nosec B105 for None token initial state false positive - prereqs_config.yaml: runtime python3.13 - README.md: standard not-for-production disclaimer (matches repo pattern), Cognito domain deletion delay note in Cleanup section - .gitignore: add .ash/ash_output/ to exclude generated scan reports ASH scan result: 0 actionable findings (bandit, cdk-nag, checkov, detect-secrets, semgrep all PASSED). 6 suppressions with justifications. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Author
Security Scan Results — ASH v3.2.5All required security fixes have been applied and the ASH scan is clean (exit 0 — 0 actionable findings). What was fixed
Suppressions with justification (6 total)All suppressions include documented justifications in the CloudFormation
ASH Security Scan Report
Scan Metadata
SummaryScanner ResultsThe table below shows findings by scanner, with status based on severity thresholds and dependencies:
Report generated by Automated Security Helper (ASH) at 2026-04-13T18:42:32+00:00 |
Author
AWS Holmes Security Scan — Findings FixedRan AWS Holmes ( Real Fixes Applied
Justified Suppressions (Not Fixed)
|
…-guard suppressions, naming standards AWS Holmes (HolmesContentSecurityReviewBaselinePolicy) reported 108 findings. All actionable findings addressed: Security fixes: - Cedar: replace hardcoded AWS account ID 943677087104 with <YOUR-ACCOUNT-ID> placeholder - S3: add Block Public Access, AES-256 encryption, and TLS-only bucket policy in prereq.sh CloudFormation cfn-guard suppressions (guard.SuppressedRules): - SQS_QUEUE_KMS_MASTER_KEY_ID_RULE on DLQ (uses SqsManagedSseEnabled) - IAM_NO_INLINE_POLICY_CHECK on all 3 IAM roles - LAMBDA_INSIDE_VPC on all 3 Lambda functions - LAMBDA_DLQ_CHECK on interceptor Lambdas (synchronous invocation) Documentation / naming: - AWS Service Name Standards: "Amazon Bedrock AgentCore" first-mention across 15 files - CloudFormation section comments: AWS Lambda, Amazon SQS, AWS IAM full names - README: soften superlative language; update AwsSolutions-L1 reason to python3.13 - utils.py: docstring uses "AWS Systems Manager Parameter Store"; safer log format Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Key capabilities demonstrated
tools/call)tools/list) and scope-based field redactionclient_id→ tenant mapping in SSM (no custom JWT claims required)client_credentialsflow with custom scopes per personaTest plan
bash scripts/prereq.sh --region us-east-1 --env dev— deploys Lambda, IAM, Cognitopython scripts/agentcore_gateway.py create— creates Gateway with interceptors and Lambda targetpython scripts/create_cedar_policies.py— attaches Cedar engine and creates 3 HR authorization policiesbash scripts/package_runtime.sh && python scripts/agentcore_agent_runtime.py create— deploys Runtimepython test/test_dlp_redaction.py— verifies all 4 personas pass field redaction assertionspython test/test_agent.py --persona hr-manager --prompt "Show me John Smith's compensation"— full agent teststreamlit run app.py— UI smoke test across all personas